Stage - Lecture des archives
Modèle
- types : Modèle à une sécrétion et Modèle à deux sécrétions
init
Code pour
Modèle à une sécrétion :
Modèle décrit par matrice \(L\times L\) d'entiers
Chaque entier différent
python
Def init(L: int, sparsity: int):
fates = range(1, sparsity+1)
lattice = np.random.choice(fates, size=(L, L))
lattice = np.where(lattice > 2, 0, lattice)
return lattice
fitness
python
Def fitnessmatrix(lattice, b=0, g=1, c=1):
: basal fitness
: good per secretion
: cost of secretion
L = lattice.shape[0]
fitness = [[b + n([i,j], lattice)g for j in range(L)] for i in range(L)]
fitness = np.where(lattice 1, lattice - c, lattice)
return fitness
iter
Processus de Poisson
utils
python
Def neighboorhood(position, lattice):
return lattice[position[0]-1:position[0]+2,position[1]-1:position[1]+2]
Def n(position, lattice):
: nb of cooperators in neighboorhood
neigh = neighboorhood(position, lattice)
return sum(neigh[neigh 1])
`